﻿using System;
using log4net;

namespace Freedom.Framework.Logging
{
    public class Log4NetLogger : ILogger
    {
        private readonly ILog _log = LogManager.GetLogger("DebugLogger");

        #region Implementation of ILogger

        public bool IsEnabled(LogLevel level)
        {
            return true;
        }

        public void Log(LogLevel level, Exception exception, string format, params object[] args)
        {
            switch (level)
            {
                case LogLevel.Debug:
                    _log.Debug(format, exception);
                    break;
                case LogLevel.Information:
                    _log.Info(format, exception);
                    break;
                case LogLevel.Warning:
                    _log.Warn(format, exception);
                    break;
                case LogLevel.Error:
                    _log.Error(format, exception);
                    break;
                case LogLevel.Fatal:
                    _log.Error(format, exception);
                    break;
            }
        }

        #endregion
    }
}
